package com.joyzone.weixin.security;

import net.sf.json.JSONObject;

/**
 * 网页授权接口调用凭证 model
 * 
 * @author yulm
 * @date 2014-01-22
 */

public class OAuthToken {
	
	// 网页授权接口调用凭证
	private String AccessToken;
	// access_token接口调用凭证超时时间,单位（秒）
	private int	ExpiresIn;
	// 用户刷新access_token
	private String RefreshToken;
	// 用户唯一标识
	private String OpenID;
	// 用户授权的作用域，使用逗号（,）分隔
	private String Scope;
	
	public OAuthToken() {
		super();
	}

	public OAuthToken(JSONObject data){
		//AccessToken = StringUtil.defaultString(data.getString("access_token"));
		AccessToken = data.getString("access_token");
		ExpiresIn = data.getInt("expires_in");
		RefreshToken = data.getString("refresh_token");
		OpenID = data.getString("openid");
		Scope = data.getString("scope");
	}
	
	public String getAccessToken() {
		return AccessToken;
	}

	public void setAccessToken(String accessToken) {
		AccessToken = accessToken;
	}

	public int getExpiresIn() {
		return ExpiresIn;
	}

	public void setExpiresIn(int expiresIn) {
		ExpiresIn = expiresIn;
	}

	public String getRefreshToken() {
		return RefreshToken;
	}

	public void setRefreshToken(String refreshToken) {
		RefreshToken = refreshToken;
	}

	public String getOpenID() {
		return OpenID;
	}

	public void setOpenID(String openID) {
		OpenID = openID;
	}

	public String getScope() {
		return Scope;
	}

	public void setScope(String scope) {
		Scope = scope;
	}
	
}
